$this->skin =& $skin;
$this->preCacheMessages();
}
-
+
function newFromUser( &$user ) {
$sk =& $user->getSkin();
if( $user->getOption('usenewrc') ) {
function insertTimestamp(&$s, &$rc) {
global $wgLang;
- # Timestamp
- $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+ # Timestamp
+ $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
}
/** Insert links to user page, user talk page and eventually a blocking link */
function insertUserRelatedLinks(&$s, &$rc) {
- $s .= $this->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
- $s .= $this->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
}
/** insert a formatted comment */
$s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
}
-
+
/**
- * Check whether to enable RC-Patrol features
+ * Check whether to enable recent changes patrol features
* @return bool
*/
function usePatrol() {
- global $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgUser;
- return $wgUseRCPatrol && $wgUser->isLoggedIn() &&
- ( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed( 'patrol' ) );
- }
-
- /**
- * Make user link (or user contributions for unregistered users)
- * @param int $userId
- * @param string $userText
- * @return string HTML fragment
- * @access private
- */
- function userLink( $userId, $userText ) {
- $encName = htmlspecialchars( $userText );
- if( $userId == 0 ) {
- $contribsPage = Title::makeTitle( NS_SPECIAL, 'Contributions' );
- return $this->skin->makeKnownLinkObj( $contribsPage,
- $encName, 'target=' . urlencode( $userText ) );
- } else {
- $userPage = Title::makeTitle( NS_USER, $userText );
- return $this->skin->makeLinkObj( $userPage, $encName );
- }
- }
-
- /**
- * @param int $userId
- * @param string $userText
- * @return string HTML fragment with talk and/or block links
- * @access private
- */
- function userToolLinks( $userId, $userText ) {
- global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
- $talkable = !( $wgDisableAnonTalk && 0 == $userId );
- $blockable = ( $wgSysopUserBans || 0 == $userId );
-
- $items = array();
- if( $talkable ) {
- $items[] = $this->userTalkLink( $userId, $userText );
- }
- if( $blockable && $wgUser->isAllowed( 'block' ) ) {
- $items[] = $this->blockLink( $userId, $userText );
- }
-
- if( $items ) {
- return ' (' . implode( ' | ', $items ) . ')';
- } else {
- return '';
- }
- }
-
- /**
- * @param int $userId
- * @param string $userText
- * @return string HTML fragment with user talk link
- * @access private
- */
- function userTalkLink( $userId, $userText ) {
- global $wgContLang;
- $talkname = $wgContLang->getNsText( NS_TALK ); # use the shorter name
-
- $userTalkPage = Title::makeTitle( NS_USER_TALK, $userText );
- $userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
- return $userTalkLink;
- }
-
- /**
- * @param int $userId
- * @param string $userText
- * @return string HTML fragment with block link
- * @access private
- */
- function blockLink( $userId, $userText ) {
- $blockPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
- $blockLink = $this->skin->makeKnownLinkObj( $blockPage,
- $this->message['blocklink'], 'ip=' . urlencode( $userText ) );
- return $blockLink;
+ global $wgUseRCPatrol, $wgUser;
+ return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) );
}
+
}
* Format a line using the old system (aka without any javascript).
*/
function recentChangesLine( &$rc, $watched = false ) {
- global $wgLang, $wgContLang, $wgUser, $wgSysopUserBans;
+ global $wgContLang;
$fname = 'ChangesList::recentChangesLineOld';
wfProfileIn( $fname );
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
function recentChangesLine( &$baseRC, $watched = false ) {
- global $wgLang, $wgContLang, $wgUser, $wgSysopUserBans;
+ global $wgLang, $wgContLang;
# Create a specialised object
$rc = RCCacheEntry::newFromParent( $baseRC );
$curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
- $rc->userlink = $this->userLink( $rc_user, $rc_user_text );
-
+ $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
+
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
- $rc->usertalklink = $this->userToolLinks( $rc_user, $rc_user_text );
+ $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
# Put accumulated information into the cache, for later display
# Page moves go on their own line
}
return $ret;
}
-
+
/**
* Enhanced RC group
*/
$r .= $users;
if($block[0]->numberofWatchingusers > 0) {
+ global $wgContLang;
$r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
}
$r .= "<br />\n";
$this->rcCacheIndex++;
return $r;
}
-
+
function maybeWatchedLink( $link, $watched=false ) {
if( $watched ) {
// FIXME: css style might be more appropriate
return $link;
}
}
-
+
/**
* Generate HTML for an arrow or placeholder graphic
* @param string $dir one of '', 'd', 'l', 'r'
$encAlt = htmlspecialchars( $alt );
return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
}
-
+
/**
* Generate HTML for a right- or left-facing arrow,
* depending on language direction.
$dir = $wgContLang->isRTL() ? 'l' : 'r';
return $this->arrow( $dir, '+' );
}
-
+
/**
* Generate HTML for a down-facing arrow
* depending on language direction.
function downArrow() {
return $this->arrow( 'd', '-' );
}
-
+
/**
* Generate HTML for a spacer image
* @return string HTML <img> tag